import 'package:get_storage/get_storage.dart';
import 'package:uuid/uuid.dart';

GetStorage box = GetStorage();
const String kDeviceIDKey = "com.hc.cure2c.device_id";

mixin DeviceMixin {
  String getDeviceUUID() {
    String? uuid = box.read<String>(kDeviceIDKey);
    return uuid ?? "";
  }

  Future saveDeviceID(String deviceUUID) async {
    await box.write(kDeviceIDKey, deviceUUID);
    await box.save();
  }

  String generateDeviceUUID() {
    final uuid = Uuid();
    final uuidString = uuid.v4();
    return uuidString;
  }
}
